package com.ywk.pattern._21_singleton._21_8;



public class Main {
    static  Singleton singleton =null;
    public static void main(String[] args) {

        for (int i=0; i < 5; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    Singleton instance = Singleton.getInstance();
                    if (singleton == null) {
                        singleton = instance;
                    }
                    System.out.println(singleton == instance);
                    singleton = instance;

                }
            }).start();
        }
    }
}
